<%--
  Created by IntelliJ IDEA.
  User: caojian
  Date: 2017/3/10
  Time: 下午5:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="xmb" uri="http://xmb.suishoupai.com/tags" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>卖家列表</title>
    <jsp:include page="common/common_css.jsp"/>
</head>
<body>
<jsp:include page="common/header.jsp"/>
<div class="ui main container">
    <jsp:include page="common/message.jsp"/>
    <button class="ui right floated basic button JS-add">
        <i class="add circle icon"></i>
        新增卖家
    </button>
    <!--商品列表数据-->
    <table class="ui celled padded table">
        <thead>
        <tr>
            <th class="center aligned">id</th>
            <th class="center aligned">卖家名</th>
            <th class="center aligned">状态</th>
            <th class="center aligned">时间</th>
        </tr>
        </thead>
        <tbody>
        <c:choose>
            <c:when test="${fn:length(sales.list) > 0}">
                <c:forEach items="${sales.list}" var="sale">
                    <tr data-id="${sale.userId}">
                        <td class="center aligned">${sale.userId}</td>
                        <td class="center aligned">${sale.name}</td>
                        <td class="center aligned">
                            <c:choose>
                                <c:when test="${sale.status==1}">
                                    营业中
                                </c:when>
                                <c:when test="${sale.status==2}">
                                    休息中
                                </c:when>
                                <c:otherwise>
                                    不知道的status
                                </c:otherwise>
                            </c:choose>
                        </td>
                        <td class="center aligned">
                            <xmb:formatDate value="${sale.createTime}"/>
                        </td>
                    </tr>
                </c:forEach>
            </c:when>
            <c:otherwise>
                <tr>
                    <td class="center aligned" colspan="4">没有一个卖家，<a href="" class="JS-add">点击添加</a></td>
                </tr>
            </c:otherwise>
        </c:choose>
        </tbody>
        <tfoot>
        <tr>
            <th colspan="6" class="center aligned">
                <c:set var="pagination" scope="session" value="${sales}"/>
                <c:set var="paginationAction" scope="session" value="sale"/>
                <jsp:include page="common/page.jsp"/>
            </th>
        </tr>
        </tfoot>
    </table>
</div>

<jsp:include page="common/footer.jsp"/>
<jsp:include page="common/common_js.jsp"/>
<script>
    $(function () {
        $('.JS-add').click(function () {
            window.location.href = ROOT + "/sale/add";
            return false;
        });
    });
</script>
</body>
</html>
